package com.axujie.tlgypt.service.webService;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import com.axujie.tlgypt.service.session.TyglptSession;

/**
 * 统一管理平台服务接口
 * @author XuJie
 * @date 2017年11月2日
 */
@WebService(serviceName = "tyglptService", portName = "ServiceInstance", name = "tyglptService", targetNamespace = "http://tyglpt.axujie.com/service")
public class TyglptService {
	
	static TyglptSession tyglptSession = null;
	static {
		tyglptSession = new TyglptSession();
	}
	
	/**
	 * 用户登录
	 * @param yhid 用户账号
	 * @param dlkl 登录口令
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param ip IP地址
	 * @return
	 */
	@WebMethod(operationName = "login")
	public String login(@WebParam(name = "yhid") String yhid, @WebParam(name = "dlkl") String dlkl, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc,@WebParam(name = "ip") String ip) {
		return tyglptSession.login(yhid,dlkl,ywxtbm,ywxtmc,ip);
	}
	
	/**
	 * HHID验证用户
	 * @param hhid 会话ID
	 * @param yhid 用户账号
	 * @param ip IP地址
	 * @return
	 */
	@WebMethod(operationName = "checkLogin")
	public String checkLogin(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip) {
		return tyglptSession.checkLogin(hhid,yhid,ip);
	}
	
	/**
	 *  获取系统菜单权限
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @return
	 */
	@WebMethod(operationName = "sysMenu")
	public String sysMenu(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc) {
		return tyglptSession.getAllMenu(hhid,yhid,ip,ywxtbm,ywxtmc);
	}
	
	
	/**
	 * 获取所有单位信息
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @return
	 */
	@WebMethod(operationName = "allDepart")
	public String allDepart(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc) {
		return tyglptSession.allDepart(hhid,yhid,ip,ywxtbm,ywxtmc);
	}
	
	/**
	 * 获取所有单位信息
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param where Where条件
	 * @return
	 */
	@WebMethod(operationName = "departByWhere")
	public String departByWhere(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc, @WebParam(name = "where") String where) {
		return tyglptSession.departByWhere(hhid,yhid,ip,ywxtbm,ywxtmc,where);
	}
	
	/**
	 * 通过单位编码获取岗位
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param dwbm 单位编码
	 * @return
	 */
	@WebMethod(operationName = "getGwByDepart")
	public String getGwByDepart(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc, @WebParam(name = "dwbm") String dwbm) {
		return tyglptSession.getGwByDepart(hhid,yhid,ip,ywxtbm,ywxtmc,dwbm);
	}
	
	/**
	 * 通过单位编码获取用户
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param dwbm 单位编码
	 * @return
	 */
	@WebMethod(operationName = "getUserByDepart")
	public String getUserByDepart(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc, @WebParam(name = "dwbm") String dwbm) {
		return tyglptSession.getUserByDepart(hhid,yhid,ip,ywxtbm,ywxtmc,dwbm);
	}
	
	/**
	 * 通过岗位获取用户
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param gwbm 岗位编码
	 * @return
	 */
	@WebMethod(operationName = "getUserByGw")
	public String getUserByGw(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc, @WebParam(name = "gwbm") String gwbm) {
		return tyglptSession.getUserByGw(hhid,yhid,ip,ywxtbm,ywxtmc,gwbm);
	}
	
	/**
	 * 通过HHID获取用户信息
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @return
	 */
	@WebMethod(operationName = "getUserByHhid")
	public String getUserByHhid(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc) {
		return tyglptSession.getUserByHhid(hhid,yhid,ip,ywxtbm,ywxtmc);
	}
	
	/**
	 * 通过条件获取用户信息
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param where Where条件
	 * @return
	 */
	@WebMethod(operationName = "getUsersByWhere")
	public String getUsersByWhere(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc,@WebParam(name = "where") String where) {
		return tyglptSession.getUsersByWhere(hhid,yhid,ip,ywxtbm,ywxtmc,where);
	}
	
	/**
	 * 通过HHID获取授权信息
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @return
	 */
	@WebMethod(operationName = "getSjsqByHhid")
	public String getSjsqByHhid(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc) {
		return tyglptSession.getSjsqByHhid(hhid,yhid,ip,ywxtbm,ywxtmc);
	}
	
	/**
	 * 通过SQL查询数据
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @param SQL SQL
	 * @return
	 */
	@WebMethod(operationName = "getDataBySql")
	public String getDataBySql(@WebParam(name = "hhid") String hhid, @WebParam(name = "yhid") String yhid, @WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc,@WebParam(name = "sql") String sql) {
		return tyglptSession.getDataBySql(hhid,yhid,ip,ywxtbm,ywxtmc,sql);
	}
	
	/**
	 * 发送消息
	 * @param msg 消息内容
	 * @param phones 接收号码
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @return
	 */
	@WebMethod(operationName = "sendMsg")
	public String sendMsg(@WebParam(name = "msg") String msg,@WebParam(name = "phones") String[] phones,@WebParam(name = "hhid") String hhid,@WebParam(name = "yhid") String yhid,@WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc) {
		return tyglptSession.sendMsg(msg,phones,hhid,yhid,ip,ywxtbm,ywxtmc);
	}
	
	/**
	 * 加密用户密码
	 * @param enyhid 用户账号
	 * @param enPass 用户密码
	 * @param hhid HHID
	 * @param yhid 用户账号
	 * @param ip IP
	 * @param ywxtbm 业务系统编码
	 * @param ywxtmc 业务系统名称
	 * @return
	 */
	@WebMethod(operationName = "enUserPass")
	public String enUserPass(@WebParam(name = "enYhid") String enYhid,@WebParam(name = "enPass") String enPass,@WebParam(name = "hhid") String hhid,@WebParam(name = "yhid") String yhid,@WebParam(name = "ip") String ip, @WebParam(name = "ywxtbm") String ywxtbm, @WebParam(name = "ywxtmc") String ywxtmc) {
		return tyglptSession.enUserPass(enYhid,enPass,hhid,yhid,ip,ywxtbm,ywxtmc);
	}
	
}
